// app.js
App({
    /**
   * 生命周期函数--监听页面加载
   */
    onLaunch() { 
        wx.cloud.init({
          env:'cloud1-2gr1ju8227535a0a'
        });
        wx.login({
          success:res=>{
            if(res.code){
              console.log('#####code:'+res.code);
              let url = "https://api.weixin.qq.com/sns/jscode2session?appid=wxe266435fd358dd6e=ff749751beb1b6253eb84289dd07668d&js_code="+res.code+'&grant_type=authorization_code'
              wx.request({
                url:url, 
                 success:function(res){ 
                   console.log('#####openid:'+res.data.openid);
                   console.log('#####session_key:'+res.data.session_key);
                   console.log('#####unionid:'+JSON.stringify(res.data,null,3));
                }
              })
            }
          }
        })
    
    },

    globalData: {
        userInfo: null,
    }
})

